﻿using System;
using TechTalk.SpecFlow;
using UnityScenarios;
using OpenQA.Selenium;
using OpenQA.Selenium.Support;
using OpenQA.Selenium.Support.UI;
using OpenQA.Selenium.IE;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Firefox;
using NUnit.Framework;
using OpenQA.Selenium.Remote;
using OpenQA.Selenium.Support.PageObjects;
using System.Threading;

namespace UnityScenarios
{
    [Binding]
    public class CreateNewUserSteps
    {
        [Given]
public void Given_I_input_New_User_details()
{
    var ie = ScenarioContext.Current["browser"] as FirefoxDriver;
    ie.FindElement(By.Name("UserName")).SendKeys("FirstLogin26");
    ie.FindElement(By.Id("FirstName")).SendKeys("Tester25");
    ie.FindElement(By.Id("LastName")).SendKeys("Test25");
    ie.FindElement(By.Id("Password")).SendKeys("Tester147");
    ie.FindElement(By.Id("ConfirmPassword")).SendKeys("Tester147");
    ie.FindElement(By.Id("Email")).SendKeys("QATest@DSTOutput.co.uk");
    ie.FindElement(By.Name("PostedRolesCheckBox.CheckBoxValues")).Click();
    ie.FindElement(By.Id("UserManCoes")).Click();
    ie.FindElement(By.Name("PostedCheckBox.CheckBoxValues")).Click();
}

        [Given]
public void Given_click_on_the_Create_New_User_button()
{
    var ie = ScenarioContext.Current["browser"] as FirefoxDriver;
    ie.FindElement(By.ClassName("createuser")).Submit();
}

        [Then]
public void Then_a_New_User_screen_is_created()
{
    var ie = ScenarioContext.Current["browser"] as FirefoxDriver;
    ie.PageSource.Contains("totalNumberOfDocuments");

    // ie.Close();
    // ie.Dispose();
}
    }
}
